#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/listener.h>

// 写管道
int main()
{    
    // 创建监听的套接字
    struct event_base* base = event_base_new();
    struct sockaddr_in serv;
    serv.sin_family = AF_INET;
    serv.sin_port = htons(9765);
    serv.sin_addr.s_addr = htonl(INADDR_ANY);
    struct evconnlistener* listen = NULL;
    evconnlistener_new_bind(base, listen_cb, NULL,
    LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE,
    -1, (struct sockaddr*)&serv, sizeof(serv));

    event_base_dispatch(base);

    evconnlistener_free(listen);
    // 绑定
    // 监听
    // 等待并

    return 0;
}